/**
 * 指令： v-loading
 */
import { ObjectDirective } from "vue";

export default {
  mounted(el, binding) {
    el.style.position = "relative";
    const mask = document.createElement("div");
    mask.setAttribute("class", "z-loading__mask");
    mask.style.display = binding.value ? "flex" : "none";
    el.appendChild(mask);
  },
  updated(el, binding) {
    const mask = el.querySelector(".z-loading__mask") as HTMLElement;
    mask.style.display = binding.value ? "flex" : "none";
  },
} as ObjectDirective<HTMLElement, boolean>;
